package com.client.act;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;

import com.client.common.ValueStack;
import com.clinet.cache.Log;

public class EidtPicAct extends BaseAct {
	/** Called when the activity is first created. */
	private Context mContext = EidtPicAct.this;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.editpic);
		init();
		getData();
		onclick();
	
		// openCapture();
	}

	private Bitmap mBitmap = null;
	private Bitmap coppyBitmap = null;
//	private Integer code = 0;

	private void getData() {
		// ValueStack.getInstance().setValue("bitmap", photo);
		// ValueStack.getInstance().setValue("SICKIMAGE", SICKIMAGE);

		if (ValueStack.getInstance().containsKey("bitmap")) {
			mBitmap = (Bitmap) ValueStack.getInstance().getValue("bitmap");
			coppyBitmap=mBitmap.createBitmap(mBitmap);
			Log.i("EidtPicAct.getData code" + coppyBitmap);
			birdImage.setImageBitmap(mBitmap);
		}

	}
	private void onclick() {
		save.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				String desS = desc.getText().toString();
				ValueStack.getInstance().setValue("bitmap", coppyBitmap);
				Log.i("save" + coppyBitmap);
				ValueStack.getInstance().setValue("desS", desS);
				DetaiAct.isSave=true;
				finish();
			}
		});
		canle.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				DetaiAct.CURRENT=-1;
				finish();
			}
		});
	}

	private ImageView birdImage = null;
	private ImageView save = null;
	private ImageView canle = null;
	private EditText desc = null;

	private void init() {
		birdImage = (ImageView) findViewById(R.id.birdImage);
		save = (ImageView) findViewById(R.id.save);
		canle = (ImageView) findViewById(R.id.canle);
		desc = (EditText) findViewById(R.id.desc);

	}
	
	

}